const {Sequelize, Model} = require('sequelize')
const {sequelize} = require('../../core/db')

const classicFileds = {
  image: Sequelize.STRING,
  content: Sequelize.STRING,
  pubdate: Sequelize.DATEONLY,
  fav_nums: {
    type: Sequelize.INTEGER,
    defaultValue: 0
  },
  title: Sequelize.STRING,
  type: Sequelize.TINYINT 
}

class Movie extends Model {

}

Movie.init(classicFileds, {
  sequelize,
  tableName: 'movie'
})


class Sentence extends Model {

}

Sentence.init(classicFileds, {
  sequelize,
  tableName: 'sentence'
})

class Music extends Model {

}

Music.init(Object.assign({
  url: Sequelize.STRING
},classicFileds), {
  sequelize,
  tableName: 'music'
})

module.exports = {
  Movie,
  Sentence,
  Music
}